#ifndef XGE_XFS_H_
#define XGE_XFS_H_

#include "xge_common_config.h"
#include "xarchive.h"
#include "xfile.h"
#include "xdir.h"
#include "xallocator.h"
#include "xsmart_ptr.h"

namespace xge{
  // A file system interface for our project, which ONLY provide read 
  // function . We design our whole VFS to be only readable . We provide
  // way to register our own XFS interface by using XFSFactory .
  class FileSystem : public Allocator {
  public:
    // Find a specific Archive using path 
    ArchivePtr LoadArchive( const String& path_name ) {
      return LoadArchive( path_name.c_str() );
    }
    virtual ArchivePtr LoadArchive( const char_t* path_name ) = 0;
    // Find a specific File using path
    FilePtr LoadFile( const String& path_name ) {
      return LoadFile( path_name.c_str() );
    }
    virtual FilePtr LoadFile( const char_t* path_name ) =0;
    // virtual dtor
    virtual ~FileSystem() {}
  public:
    // Testing a file or archive is existed or not
    virtual bool IsExisted( const String& path ) = 0;
    // Testing a file is existed  or not
    virtual bool IsFileExisted( const String& path ) =0;
    // Testing a archive is existed or not
    virtual bool IsArchiveExisted( const String& path ) =0;
  public:
    // The name of a file system is very important
    // it should be unique during the whole system , and it is the only way
    // to access to a specific sub file system 
    const String& name() const {
      return name_;
    }
    FileSystem( const String& name ) : name_(name) {}
  private:
    String name_;
  };
  typedef xge_internal::SharedPtr< FileSystem , xge_internal::DefaultDestructor<FileSystem> > FileSystemPtr;


} // namespace xge
#endif// XGE_XFS_H_